package com.hongdee.crm.task.dto;

import java.util.List;
import java.util.Map;

/**
 * 名  称: MainTainDTO
 * 类  型: class
 * 描  述: 保养处理 参数传输DTO
 * 路  径: com.hongdee.crm.task.dto
 * 作  者: wangshuai
 * 日  期:
 */
public class MainTainDTO {

    //参数类型
    public String code;
    //参数名称
    public String name;
    //提醒天数
    public String txts;
    //提醒天数值
    public Long txtsNums;
    //计算月份
    public String jsyf;
    //计算月份值
    public Long jsyfNums;
    //上一级的参数Code
    public String lastLvCode;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTxts() {
        return txts;
    }

    public void setTxts(String txts) {
        this.txts = txts;
    }

    public Long getTxtsNums() {
        return txtsNums;
    }

    public void setTxtsNums(Long txtsNums) {
        this.txtsNums = txtsNums;
    }

    public String getJsyf() {
        return jsyf;
    }

    public void setJsyf(String jsyf) {
        this.jsyf = jsyf;
    }

    public Long getJsyfNums() {
        return jsyfNums;
    }

    public void setJsyfNums(Long jsyfNums) {
        this.jsyfNums = jsyfNums;
    }

    public String getLastLvCode() {
        return lastLvCode;
    }

    public void setLastLvCode(String lastLvCode) {
        this.lastLvCode = lastLvCode;
    }


    public static MainTainDTO analyParams(List<Map<String,Object>> lists, String txts, String jsyf, String lastLvCode){
        MainTainDTO mainTainDTO=new MainTainDTO();
        mainTainDTO.setLastLvCode(lastLvCode);
        for (Map<String,Object> map:lists) {
            String code=String.valueOf(map.get("code"));
            if(code.equals(jsyf)){
                Long nums=Long.valueOf(String.valueOf(map.get("value")));
                mainTainDTO.setJsyf(code);
                mainTainDTO.setJsyfNums(nums);
            }else if(code.equals(txts)){
                Long nums=Long.valueOf(String.valueOf(map.get("value")));
                mainTainDTO.setTxts(code);
                mainTainDTO.setTxtsNums(nums);
            }
        }
        return mainTainDTO;
    }

}
